#include <QCoreApplication>
#include <iostream>
using namespace std;

//#include "carray.h"

void sizeofStrlenDiff(char a[])
{
    int sizeofLen = sizeof(a);
    int strlenLen = strlen(a);

    a[0] = 'H';
    a[1] = 'O';
    int test = 0;
}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
//    int arr[6] = {0, 2, 4, 6, 8, 10};
//    int (&p)[6] = arr;
    char ca1[] = {'c', '+', '+'};
    char ca2[] = {'c', '+', '+', '\0'};
    char ca3[] = "c++";

//    int calLen1 = strlen(ca1);
//    int calLen2 = strlen(ca2);
//    int calLen3 = strlen(ca3);

    int calLen1 = sizeof(ca1);
    int calLen2 = sizeof(ca2);
    int calLen3 = sizeof(ca3);

    cout << "ca1 len: " << calLen1 << endl;
    cout << "ca2 len: " << calLen2 << endl;
    cout << "ca3 len: " << calLen3 << endl;

    const char ch3[7] = "Daniel";
    cout << "ch3 size: " << sizeof(ch3) << endl;

    char charA = 'a';
    cout << "charA size: " << sizeof(charA) << endl;

    int iA[3][2] = {(0, 1), (2, 3), (4, 5)};
    int *p = iA[0];
    printf("%d", p[0]);

    // dynamic declare two dimension array
    const int m = 3;
    const int n = 4;

//    int *p1 = new int();
//    int *array = new int [3];
//    int **arrB = new int* [m];
//    for(int i = 0; i < m; i++) {
//        arrB[i] = new int [n];
//    }

//    for(int i = 0; i < 3; ++i) {
//        for(int j = 0; j < 4; ++j) {
//            arrB[i][j] = 4*i + j;
//        }
//    }


//    int *array = new int [3][2];
    int *array[10];  /*point array*/
    int (*array1)[10]; /*array point*/

    int array2[4][10];
    int (*pArray)[10];

    pArray = array2;

    {
        char p[] = "hell        o";
        int pLen = sizeof(p);
        int pLen2 = strlen(p);

        sizeofStrlenDiff(p);
        p[0] = 'H';
    }

    return a.exec();
}
